<?php $post = $this->get('post');?>
<form method="post" action="<?php _actionUrl($this)?>" onsubmit="return ajax_form(this)">
<input type="hidden" name="ID" value="<?php _e( $post['ID'] )?>"/>
<div class="x-list-title"> 
<table height="100%" width="100%" border="0" cellpadding="0">
<tr><td>
<h2>Danh bạ cá nhân mới</h2>
</td></tr></table>
</div>
<div class="x-form-container">
<div class="form-message"><?php $this->e('message');?></div>
<table width="100%" border="0" cellpadding="0" class="x-form">
<tr>
	<td class="x-form-label" style="width:100px">
		Họ tên: 
	</td>
	<td class="x-form-input">
		<input type="text" name="title" style="width:400px" class="x-text" value="<?php _e( $post['title'] )?>"/>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Chức vụ: 
	</td>
	<td class="x-form-input">
		<input type="text" name="job_title" style="width:300px" class="x-text" value="<?php _e( $post['job_title'] )?>"/>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Công ty: 
	</td>
	<td class="x-form-input">
		<select name="company_id" id="option-contact-company" class="x-select" style="min-width:200px">
		<option></option>
		<?php foreach( $this->get('companies') as $a ):?>
		<option value="<?php _e($a['ID'])?>"<?php if( $a['ID']==$post['company_id']) _e(' selected')?>><?php _e($a['title'])?></option>
		<?php endforeach;?>
		</select><a onclick="load_inframe('<?php _baseUrl()?>/Contact/Index/Addcompany?_iframe=yes',{title:'Tạo nhanh công ty'})" class="quick-add" title="Tạo nhanh..."></a>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Phòng ban: 
	</td>
	<td class="x-form-input">
		<input type="text" name="department" style="width:300px" class="x-text" value="<?php _e( $post['department'] )?>"/>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Địa chỉ: 
	</td>
	<td class="x-form-input">
		<input type="text" name="address" style="width:300px" class="x-text" value="<?php _e( $post['address'] )?>"/>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Địa chỉ khác: 
	</td>
	<td class="x-form-input">
		<input type="text" name="address2" style="width:300px" class="x-text" value="<?php _e( $post['address2'] )?>"/>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Email: 
	</td>
	<td class="x-form-input">
		<input type="text" name="email" style="width:300px" class="x-text" value="<?php _e( $post['email'] )?>"/>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Điện thoại: 
	</td>
	<td class="x-form-input">
		<input type="text" name="phone" style="width:100px" class="x-text" value="<?php _e( $post['phone'] )?>"/>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Di động: 
	</td>
	<td class="x-form-input">
		<input type="text" name="mobile" style="width:100px" class="x-text" value="<?php _e( $post['mobile'] )?>"/>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Fax: 
	</td>
	<td class="x-form-input">
		<input type="text" name="fax" style="width:100px" class="x-text" value="<?php _e( $post['fax'] )?>"/>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Trang web: 
	</td>
	<td class="x-form-input">
		<input type="text" name="homepage" style="width:300px" class="x-text" value="<?php _e( $post['homepage'] )?>"/>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Ghi chú: 
	</td>
	<td class="x-form-input">
		<textarea name="desc" style="width:400px;height:100px" class="x-text"><?php _e( $post['desc'] )?></textarea>
	</td>
</tr>
<!--
<tr>
	<td class="x-form-label" align="center" valign="top">
		<span class="x-attachment"></span>
	</td>
	
	<td class="x-form-input" valign="top">
		<div id="contact_img">
			<?php if( $post['img'] ):?>
			<a href="<?php _baseUrl();?>/files/contact/<?php _e( $post['img'] );?>" target="_blank">
				<img src="/files/contact/<?php _e( $post['img'] )?>"/></a>		
			<a onclick="ajax_load('<?php _baseUrl();?>/Contact/Index/Deleteimgperson?ID=<?php _e( $post['ID'] );?>')">[Xóa ảnh]</a>	
			<?php endif;?>
		</div>
		<div class="x-file" filename="img" filetypes="*.gif;*.jpg;*.png;*.jpeg" url="<?php _baseUrl();?>/Contact/Index/Uploadperson?ID=<?php _e( $post['ID'] )?>">Ảnh đại diện</div>
	</td>
</tr>
-->
<!-- TUY CHON-->
<tr>
	<td colspan="2">
		Tùy chọn 
	</td>
</tr>
<tr>	
	<td class="x-form-label">
		Chọn nhãn:
	</td>
	<td class="x-form-input">
		<?php foreach( $this->get('labels') as $t ):?>
		<span style="padding:4px">
			<input type="checkbox" name="labels[]" style="vertical-align:baseline" value="<?php _e($t['ID'])?>"<?php _e($t['checked'])?>> <?php _e($t['label'])?>
		</span>	
		<?php endforeach;?>	
	</td>
</tr>
<tr>	
	<td class="x-form-label">
		Cho xem:
	</td>
	<td class="x-form-input">
		<div class="x-select-users" x-name="users[]" x-title="Cho xem liên hệ này">
		<?php foreach( $this->get('users') as $u ):?>
		<span class="item">
			<input type="hidden" name="users[]" value="<?php _e($u['ID'])?>"><?php _e(get_user_link($u));?><span class="close">x</span>
		</span>
		<?php endforeach;?>			
		</div>
	</td>
</tr>

<tr>
	<td></td>
	<td>
		<?php _e(tpl_button_add('Cập nhật'));?>
		<a class="x-button x-fresh" href="#Contact">Hủy bỏ</a>		
	</td>
</tr>
</table></div>
</form>